<template>
	<view class="comLack">
		<view class="box" @click.stop="">
			<image src="https://siha.vxmeng.com/static/component/lack_bg_big.png" mode="widthFix"></image>
			<view class="top">
				<text class="tit">{{$t('common.shczfl')}}</text>
				<image src="https://siha.vxmeng.com/static/component/rrr.png" mode="widthFix"></image>
			</view>
			<view class="c">
				<image src="https://siha.vxmeng.com/static/component/lack_dou.png" mode="widthFix"></image>
				<text>x{{shareText.money}}</text>
				<view class="jsq">
					<text>{{$t('common.zzjsq')}}</text>
				</view>
			</view>
			<view class="share-img">
				<image src="https://siha.vxmeng.com/static/component/share-text3.png" mode="widthFix"></image>
			</view>
			<view class="ul">
				<view class="li">{{shareText.remark1}}</view>
				<view class="li">{{shareText.remark2}}</view>
				<view class="ts">({{shareText.sub_title}})</view>
			</view>
			<view class="btns">
				<!-- <view class="btn" @click="close">{{$t('common.fq')}}</view> -->
				<button open-type="share" :data-type="'888'" :data-code="share_code"><view class="btn" @click="onShare">{{shareText.button1}}</view></button>
				<button open-type="share" :data-type="'888'" :data-code="share_code"><view class="btn last" @click="onShare">{{shareText.button2}}</view></button>
			</view>
			
			<view class="close" @click="close"></view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "comLack",
		// props: {
		// 	value: {
		// 		type: String,
		// 		default: "1000",
		// 	}
		// },
		data() {
			return {
				share_num: 0,
				userinfo: {},
				share_code: '',
				shareText:{},
			};
		},
		mounted() {
			uni.getSystemInfo({
				success: (res) => {  
					if (res.windowWidth > res.windowHeight) {  
						setTimeout(()=>{
							if(this.$music.bgmInstance){
								this.$music.bgmInstance.destroy();
								this.$music.bgmInstance = null;
							}
						}, 0)
					}
				}  
			})
			this.getUserinfo()
			this.shareProp()
			// this.share_num = this.$tools.getStore('share_num')
		},
		methods: {
			async shareProp() {
				console.log('-----')
				const res = await this.$myRequest({
					url: 'api/system/getSystemShareword',
					data: {}
				})
				this.shareText = res.data
				console.log('打印',this.shareText)
			},
			async getUserinfo() {
				const res = await this.$myRequest({
					url: 'api/user/index',
					method: 'GET',
					data: {}
				})
				if (res.code == 1) {
					console.log(res)
					this.userinfo = res.data
					this.share_code = res.data.share_code
				}
			},
			async onShare(){
				console.log(this.userinfo.share_code);
				// const date = this.$tools.getStore('date');
				// let today = new Date();
				// const year = today.getFullYear();
				// const month = today.getMonth() + 1;
				// const day = today.getDate();
				// today = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
				// if(date != today){
				// 	this.$tools.setStore('date', today);
				// 	this.$tools.setStore('share_num', 0)
				// 	this.share_num = this.$tools.getStore('share_num')
				// }else{
				// 	this.share_num = this.$tools.getStore('share_num');
				// }
				// this.share_num++
				// const res = await this.$myRequest({
				// 	url: 'api/share/getShareStatus',
				// 	method: "GET",
				// 	data:{}
				// });
				// console.log(res);
				// if(res.data.status != 1){
				// 	// this.$tools.setStore('share_num', this.share_num)
				// 	this.$tools.setStore('noInvite', true)
				// 	this.$emit('hide',1)
				// }else{}
					
				const resu = await this.$myRequest({
					url: 'api/share/doAddShareLog',
					data: {
						url: "/pages/index/index?share_type=888&share_code="+this.userinfo.share_code,
					}
				})
				//如果加了嘶豆
				if(resu.data.is_change_money==1){
					this.$tools.setStore('share_dou', true)
					this.$emit('hide',2)
				}else{
					this.$emit('hide',1)
				}
			},
			close() {
				this.$emit('hide',0)
			}
		},
	}
</script>

<style lang="less" scoped>
.comLack{
	width: 100vh;
	height: 100vw;
	display: flex;
	align-items: center;
	justify-content: center;
	position: fixed;
	top: 0;
	left: 0;
	color: #fff;
	background: rgba(#000, 0.5);
	z-index: 10000000000000;
	.box{
		width: 263px;
		height: 290px;
		display: flex;
		flex-direction: column;
		position: relative;
		&>image{
			width: 100%;
			position: absolute;
			bottom: 0;
			left: 0;
			z-index: -1;
		}
		.top{
			transform: rotate(-3deg);
			font-size: 12px;
			position: relative;
			top: 25px;
			text{
				margin-left: 20px;
				margin-right: 10px;
			}
			image{
				width: 28px;
				margin-left: 4px;
				transform: rotate(5deg);
			}
		}
		.c{
			height: 50px;
			position: relative;
			margin-top: 50px;
			display: flex;
			justify-content: center;
			background: linear-gradient(131deg, #BBDFFA 10%, #9ED1F8 31%, #5855E8 109%);
			-webkit-background-clip: text;
			// -webkit-text-fill-color: transparent;
			&>text{
				font-size: 24px;
				line-height: 34px;
				font-weight: 600;
				transform: rotate(-3deg);
				background: linear-gradient(114deg, #FFDE4E -6%, #FF7C0D 80%, #FFDE7A 150%);
				-webkit-background-clip: text;
				-webkit-text-fill-color: transparent;
				text-shadow: #FFa020 1px 1px 1px;
			}
			image{
				width: 80px;
				margin-right: 10px;
			}
			.jsq{
				color: #316DD1;
				font-size: 7px;
				position: absolute;
				bottom: 0px;
				right: 18px;
				transform: rotate(-8deg);
			}
		}
		.share-img{
			display: flex;
			justify-content: center;
			image{
				width: 220px;
			}
		}
		.ul{
			width: 100%;
			padding-left: 30px;
			font-size: 10px;
			color: #fff;
			margin-top: -2px;
			.li{
				margin: 5px 0;
				padding-left: 14px;
				background: url(https://siha.vxmeng.com/static/component/star.png) no-repeat center left;
				background-size: 8px;
				&:last-child{
					font-size: 8px;
					background-position-y: top;
					margin-top: 5px;
				}
			}
			.ts{
				font-size: 8px;
			}
		}
		.btns{
			width: 212px;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin: 15px auto;
			.btn{
				width: 96px;
				height: 30px;
				text-align: center;
				line-height: 30px;
				font-size: 11px;
				box-shadow: 1px 2px 0px 0px #6037c8;
				-webkit-text-stroke: 1px #EEF;
				background: linear-gradient(0deg, #5F64FC 11%, #62B6FC 70%, #D0EAFF 100%);
				border-radius: 20px;
				&.last{
					-webkit-text-stroke: 1px #EFE;
					background: linear-gradient(180deg, #F4F100 0%, #D5D94E 32%, #FF7C0D 88%);
				}
			}
			button{
				border: none;
				color: #fff;
				overflow: visible;
				margin-bottom: 0;
				&::after{
					display: none;
				}
			}
		}
		.close{
			width: 26px;
			height: 26px;
			background: url('https://siha.vxmeng.com/static/index/close.png') no-repeat center/100%;
			position: absolute;
			top: 0;
			right: -8px;
		}
	}
}
</style>